iT邦幫忙

2024 iThome 鐵人賽

DAY 13
0
Security

網路安全基礎概念與實作系列 第 13

Day 13: 使用 John the Ripper 破解 MD5 雜湊密碼

  • 分享至 

  • xImage
  •  

John the Ripper (JtR) 是最受歡迎的密碼破解工具,我的目標是實際操作 John the Ripper (JtR) ,破解一個簡單的 MD5 雜湊密碼。

1. 安裝 John the Ripper

https://ithelp.ithome.com.tw/upload/images/20240927/20169199VlN8hx4NCh.png
在openwall-John the Ripper password cracker的網頁中,我下載 Windows 版的壓縮檔案,解壓縮後會看到一個 run 資料夾。
https://ithelp.ithome.com.tw/upload/images/20240927/20169199xZ1uV5r3lx.png
輸入john.exe檢查是否安裝成功。
https://ithelp.ithome.com.tw/upload/images/20240927/20169199gwWLcMiD98.png
編輯環境變數。
https://ithelp.ithome.com.tw/upload/images/20240927/20169199P7Oe2EtpXG.png
到命令提示字元檢查是否成功設定路徑。

2. 準備要破解的雜湊密碼

我使用一個簡單的 MD5 雜湊密碼作為目標。以下是一個簡單的 MD5 雜湊:

  • 密碼:admin
  • MD5 雜湊:21232f297a57a5a743894a0e4a801fc3

我們將這個雜湊放到一個文字檔案中,供 JtR 破解使用。

  1. 在 JtR 的 run 資料夾中,建立一個名為 hashes.txt 的檔案。
  2. 將上述雜湊 21232f297a57a5a743894a0e4a801fc3 複製到 hashes.txt,內容如下:
    21232f297a57a5a743894a0e4a801fc3
    

3. 破解 MD5 雜湊

現在,我們來使用 John the Ripper 破解這個雜湊。

  1. 開啟命令提示字元,導航到 John the Ripper 的 run 資料夾:

     C:\Users\user\Downloads\Johntheripper\john-1.9.0-jumbo-1-win64\run
    
  2. 使用以下指令來破解雜湊:

    john --wordlist=rockyou.txt hashes.txt
    

    指定使用 RockYou 字典檔案,裡面包含大量常見密碼。
    hashes.txt是我們之前準備的目標雜湊檔案。

4. 破解結果

John the Ripper 會開始嘗試用字典中的密碼去匹配雜湊,當它找到匹配的密碼時,會顯示破解結果。

Using default input encoding: UTF-8
Loaded 1 password hash (MD5 [MD5 128/128 AVX 4x3])
Press 'q' or Ctrl-C to abort, almost any other key for status
admin      (?)
1g 0:00:00:00 DONE (2024-09-27 15:05) 4.567g/s 5000Kp/s 5000Kc/s 5000KC/s 123456..password
Use the "--show" option to display all of the cracked passwords reliably
Session completed.

看到結果就代表破解成功!可以看到原始密碼是 admin

今天我學到如何使用 John the Ripper 來破解一個簡單的 MD5 雜湊密碼,從中理解到密碼破解工具的運作方式,以及為什麼在日常中不要使用常見的密碼。在應用時,這些工具能幫助專家測試系統的安全性,也讓我了解到要謹慎保護自己的資料,避免使用容易被破解的密碼。


上一篇
Day 12: 密碼破解工具
下一篇
Day 14: 防禦密碼破解的技術(1)
系列文
網路安全基礎概念與實作26
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言